import sun.security.pkcs.ContentInfo;

import java.util.*;

public class Lx {
    public static void main(String[] args) {
        Persons persons1 = new Persons("1","小明","18", Arrays.asList("麻辣","清汤","微微辣"),new String[]{"篮球","乒乓球","足球"});
        Persons persons2 = new Persons("2","小李","20", Arrays.asList("火锅","香锅","小龙虾"),new String[]{"斗蛐蛐","篮球","冰壶"});

        //获得到小李的食物兴趣
        List<String> chiLike = persons2.getChiLike();
        //获得到小明的食物兴趣
        List<String>  chixiaomiing = persons1.getChiLike();  //------------------------------------------------------

        //取出小李的食物兴趣-
        for (int i = 0; i < chiLike.size(); i++) {
            String ff = chiLike.get(i);
            //取出小明的食物兴趣
            String s = chixiaomiing.get(i);
            //把小李的食物兴趣追加到小明的食物兴趣后面
            String ss = s+ff;
            //放回小明食物兴趣里面
            chixiaomiing.set(i,ss);
        }
             //打印小明的食物兴趣三种取法
        for (String s : chixiaomiing) {
            System.out.println(s);
        }
        for (int i = 0 ; i < chixiaomiing.size(); i++){
            String ss = chixiaomiing.get(i);
            System.out.println(ss);
        }
        Iterator<String> it = chixiaomiing.iterator();
        while (it.hasNext()){
            String next = it.next();
            System.out.println(next);
        }


        String[] tt = persons1.getTiYu();
        for (String t : tt){
            System.out.println(t);
        }
        System.out.println("******************************************");
        String[] ttt = persons2.getTiYu();
        for (int i = 0 ; i < ttt.length;i++){
            System.out.println(ttt[i]);
        }
        System.out.println("********************去重**********************");

        Set<String> strings = new HashSet<String>();
      for (String s : tt) {
          strings.add(s);
      }

      for (String ss : ttt) {
          strings.add(ss);
      }
      for (String string : strings) {
          System.out.println(string);
      }
    }
}


